
#include <iostream>
using namespace std;
class CPolygon 
{
protected:
	int w,h;
public:
	void setValues(int a, int b);
};
void CPolygon::setValues(int a, int b)
{
	w=a;
	h=b;
}
class COutput
{
public:
	void writeln (int i);
};
void COutput::writeln (int i) 
{
          cout << i << endl;
}

class CRectangle:public CPolygon,public COutput
{
public:
	int area();
};
int CRectangle::area()
{
	return (w*h);
}
class CTriangle:public CPolygon, public COutput
{
public:
	int area();
};
int CTriangle::area()
{
	return (w*h/2);
}
int main()
{
	CRectangle rect;
	CTriangle trgl;
	rect.setValues(4,5);
	trgl.setValues(4,5);
	rect.writeln(rect.area());
	trgl.writeln(trgl.area());
	return 0;

}